Preloading resource dictionaries

In Kanzi you can load resource dictionaries of prefabs you use in your project before your Kanzi application shows them to users. For example, you can create a loading screen that your users see while Kanzi is loading the resource dictionaries of the rest of your application in the background. Once your application loads all the resources you select, it switches from the loading screen to the part of the application you select.

To preload resource dictionaries:

  1. Create a loading screen and place it under Screen > Root Layer. Your users see the content of your loading screen while Kanzi loads the resource dictionaries of your application.
    For example, create and image and show it in an Image Layer, or create a Scene which contains an animation that is shown while Kanzi is loading the resources.
  2. Create your Kanzi application in Prefabs and add to the scope of each prefab all the resources used by that prefab. See Prefabs and Using local and global resources.
  3. In the Project select the Root Layer, in the Properties click Add Triggers, and add the Node Attached to Graph trigger.

  4. In the Properties > Node Attached to Graph trigger click the Add drop-down menu, and select Preload Resources action.
  5. In the Argument Editor:
  6. In the Project select the Screen, in the Properties click Add Triggers, and add Preloading of Resources Completed trigger.
  7. In the Properties click the Add drop-down menu for the Preloading of Resources Completed trigger, and select Replace Node action.
  8. In the Argument Editor set:
  9. (Optional) If you are using a transition from the loading screen to your Kanzi application, to make the transition smoother add a 1 ms delay to the action you use to start the transition from the loading screen to the application. Because the instantiation of the application takes some time, by adding a delay to the start of the transition, you tell Kanzi to hold the transition until it completes the instantiation.
    For example, if you are using a transition layer, add the 1 ms delay to the Transition Layer: Start Transition action.

See also

Using local and global resources

Using external resource dictionaries

Loading resources in parallel

Resource management

Triggers

Prefabs